package com.bhs.sansonglogistics.ui.mine;

import androidx.appcompat.app.AppCompatActivity;

import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bhs.sansonglogistics.BuildConfig;
import com.bhs.sansonglogistics.R;
import com.bhs.sansonglogistics.base.BaseActivity;
import com.bhs.sansonglogistics.dialog.MyClickListener;
import com.bhs.sansonglogistics.dialog.VersionUpdatingDialog;
import com.bhs.sansonglogistics.ui.home.MainActivity;
import com.bhs.sansonglogistics.utils.LogUtils;
import com.bhs.sansonglogistics.utils.MyUtils;
import com.bhs.sansonglogistics.utils.ToastUtil;

import com.bhs.sansonglogistics.utils.VersionUpdatingUtils;


import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;

/**
 * 关于伞送
 */
public class AboutUsActivity extends BaseActivity implements View.OnClickListener {


    private TextView mTvVersions;
    private LinearLayout mLlNewVersion;
    private TextView mTvName;
    private LinearLayout mLlService;
    private LinearLayout mLlRealNameAuthentication;//给我们打分
    private LinearLayout mLlCertification;//平台资质
    private LinearLayout mLlMyCircle;//我的圈子
    private LinearLayout mLlAgreement;
    private final String serviceTel = "4008899050";
    private TextView mTvServiceTel;

    @Override
    public int initLayout() {
        return R.layout.activity_about_us;
    }

    @Override
    public void initView() {

        TextView mTvTitle = findViewById(R.id.tv_title);
        mTvTitle.setText("关于伞送");
        mTvVersions = findViewById(R.id.tv_versions);
        mLlNewVersion = findViewById(R.id.ll_new_version);
        mTvName = findViewById(R.id.tv_name);
        mLlService = findViewById(R.id.ll_service);
        mLlRealNameAuthentication = findViewById(R.id.ll_real_name_authentication);
        mLlCertification = findViewById(R.id.ll_certification);
        mLlAgreement = findViewById(R.id.ll_agreement);

        mLlService.setOnClickListener(this);
        mLlAgreement.setOnClickListener(this);
        mLlCertification.setOnClickListener(this);
        mLlNewVersion.setOnClickListener(this);
        mTvServiceTel = findViewById(R.id.tv_service_tel);
    }

    @Override
    public void initData() {
        mTvVersions.setText(String.format("V%s", BuildConfig.VERSION_NAME));
        mTvName.setText(String.format("V%s", BuildConfig.VERSION_NAME));
        mTvServiceTel.setText(serviceTel);
    }

    @SuppressLint("NonConstantResourceId")
    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.ll_new_version:
                VersionUpdatingUtils.versionUpdating(mActivity);
                break;
            case R.id.ll_service:
                MyUtils.callPhone(mActivity, serviceTel);
                break;
            case R.id.ll_agreement:
                startActivity(new Intent(mActivity, SecondaryPageActivity.class).putExtra("type", 1));
                break;
            case R.id.ll_certification:
                startActivity(new Intent(mActivity, SecondaryPageActivity.class).putExtra("type", 2));
                break;
        }
    }



}